/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./src/scripts/slider.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./src/scripts/slider.js":
/*!*******************************!*\
  !*** ./src/scripts/slider.js ***!
  \*******************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("\r\nfunction move(eleNode,target,attr,index){\r\n    var iNow = parseInt($(eleNode).css(attr));\r\n    var speed = (target - iNow);\r\n    iNow +=speed;\r\n    $(eleNode).css(attr,iNow + \"px\");\r\n    $(eleNode).children().css(\"opacity\",\"0\");\r\n    $(eleNode).children().eq(index).animate({opacity:\"1\"},1000);\r\n}\r\n\r\nclass Slider{\r\n    constructor(selector){\r\n        this.selector = selector;\r\n        this.init(this.selector);\r\n    }\r\n    init(selector){\r\n        this.bannerContainer = $(selector);\r\n        this.btnContainer=$('.ck-slidebox');\r\n        this.bannerList = this.bannerContainer.children();\r\n        this.btn=$(\".dot-wrap\").children();\r\n        this.length = this.bannerList.length;\r\n        this.index = 0;\r\n        this.autoTimer = null;\r\n        this.bindEvent();\r\n        this.autoPlay();\r\n    }\r\n    bindEvent(){\r\n        $(\".ck-prev\").unbind('click').click(this.toPrev.bind(this,this.index));\r\n        $(\".ck-next\").unbind('click').click(this.toNext.bind(this,this.index));\r\n\r\n        //鼠标放在li上时停止轮播\r\n        this.bannerContainer.mouseenter((event)=>{\r\n            clearInterval(this.autoTimer);\r\n        })\r\n        this.bannerContainer.mouseleave(()=>{\r\n           this.autoPlay();\r\n        })\r\n        //鼠标在按钮上时相对应的li展示\r\n        this.btnContainer.on(\"mouseenter\",\"li\",this.toIndex);\r\n        this.btnContainer.on(\"mouseleave\",\"li\",this.goNext);\r\n    }\r\n    toIndex(){\r\n       var index=$(this).attr(\"index\");\r\n       $(this).css(\"background\",\"#fff\");\r\n    }\r\n    goNext(){\r\n        $(this).css(\"background\",\"rgba(0,0,0,0.1)\");\r\n    }\r\n    autoPlay(){\r\n        this.autoTimer=setInterval(()=>{\r\n            $(\".ck-next\").trigger(\"click\");\r\n        },6000)\r\n        //因第一次第一张图展示的是第一个li，所以首先调用一次this.btnShow();\r\n        this.btnShow();\r\n    }\r\n    \r\n     //轮换图按钮\r\n    btnShow(){\r\n        this.btn.each((index)=>{\r\n            if(index == this.index){\r\n             this.btn[this.index].style.background=\"#fff\";\r\n              return false;\r\n            }else{\r\n              this.btn.css(\"background\",\"rgba(0,0,0,0.1)\")\r\n            }\r\n        })\r\n        //除了第一次轮播图的第一张是第一个li以后的每一个都是最后一个li，所以第一个按钮对应最后一个li；\r\n        if(this.index === this.length-1 || this.index === 0){\r\n            this.btn.css(\"background\",\"rgba(0,0,0,0.1)\")\r\n            this.btn[0].style.background=\"#fff\";\r\n        }\r\n    }\r\n    toNext(){\r\n        clearInterval(this.autoTimer);\r\n        if(this.index === this.length-1){\r\n            this.index = 0;\r\n        }else{\r\n            this.index ++;\r\n        }\r\n        this.animate(\"next\");\r\n    }\r\n    toPrev(){\r\n        if(this.index === 0){\r\n            this.index = this.length -1;\r\n        }else{\r\n            this.index --;\r\n        }\r\n        this.animate(\"prev\")\r\n    }\r\n    animate(arg){\r\n        if(this.index === 0 && arg ===\"next\"){\r\n            this.bannerContainer.css(\"left\",0);\r\n            this.index ++;\r\n        }\r\n        if(this.index === length-1 && arg ===\"prev\"){\r\n            this.bannerContainer.css(\"left\",(-(this.length - 1) * 720)+\"px\");\r\n            this.index --;\r\n        }\r\n        move(this.bannerContainer,-this.index*720,\"left\",this.index);\r\n        this.btnShow();\r\n    }\r\n}\r\nvar warp = $(\".ck-slide-wrapper\");\r\nlet slider = new Slider(warp);\r\n\r\n\r\n\n\n//# sourceURL=webpack:///./src/scripts/slider.js?");

/***/ })

/******/ });